import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/views/layout/index.vue'
import TrafficRouter from './modules/Traffic'
import tenementRouter from './modules/tenement'
import SystemRouter from './modules/System'
import ParkmanagementRouter from './modules/Parkmanagement'
import IntegratedrodRouter from './modules/Integratedrod'
// 动态数组
const asyncRoutes = [TrafficRouter,tenementRouter,SystemRouter,ParkmanagementRouter,IntegratedrodRouter] // 一个数组中有一个变量
// 固定路由
const constantRoutes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue'),
    hidden: true
  },
  {
    path: '/',
    redirect: '/dashboard', // 跳转
    component: Layout,
    // 子节点
    children: [
      {
        path: 'dashboard', // 二级路由的地址
        component: () => import('@/views/dashboard/index.vue'),
        // 路由元信息
        meta: {
          title: '工作台',
          icon: 'HomeOutlined'
        }
      }
    ],
   
   
  }, 
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [...constantRoutes,...asyncRoutes] // 合并固定路由 和静态路由
})

export default router